import {getSenceUserList,queryAllKnowLedgeQuestion} from '@/api/knowledgeCompet'
//一些公共方法(获取比赛人员和比赛题目等)，用来判断是否可以计算积分，开始比赛等等
const webscoket = {
  data() {
    return {
      
    }
  },
  computed:{
     
  },
  created(){
    
  },
  mounted(){
  	
  },
  methods: {
  	getSenceUserList(){
      	return new Promise((resolve,reject) => {
      		let params = {
	          page:1,
	          rows:10,
	          refId:this.competeDetail.id
	      	}
	      	getSenceUserList(params).then(data=>{
			      if(data.code==1){
			        this.userTotal = data.attribute.totalCount;
			        resolve(this.userTotal);
			      }else{
			      	resolve(0);
			      }
			    }).catch(error => {
			    	resolve(0);
			    })
      	})
      },
      queryAllQuestion(){
      	return new Promise((resolve,reject) => {
	        let queryObj = {
	          page:1,
	          rows:10
	        };
	        queryAllKnowLedgeQuestion(this.competeDetail.id,queryObj).then(data=>{
	          if(data.code===1){
	            this.quesTotal = data.attribute.totalCount;
	            resolve(this.quesTotal);
	          }else{
				      	resolve(0);
			      }
			    }).catch(error => {
			    	resolve(0);
			    })
		    })
      },
  },
  destroyed(){
     
  }
}

export default webscoket
